/**
 * Created by jocky on 15/09/2017.
 */
/**
 * 注册
 */
function sendReg() {
    var form = $("#form1");

    var params = {};
    var validFlag = true;
    $.each(form.find('input,select'), function (i, v) {
        if (v.name != "") {
            var val = v.value;
            if (!val) {
                $(v).focus();
                setNotify($(v).attr('data-error'), true);

                validFlag = false;
                return false;
            }

            params[v.name] = v.value;
        }
    });
    // var names = $("input[name='loginName']").val();
    // document.cookie="name="+names;
    if (!validFlag) return false;

    $.post("/reg/submit", params, function (json) {
        if (json.code == 1) {
            window.location.href = "/reg/info";
        } else {
            refreshCaptcha(1);
            setNotify(json.msg, true);
        }
    }, 'json');
}